<?php
/**
 * BDataColumn widget
 *
 * @category  Finlandia_Coctails
 * @author    Engeny Utehin <utehin@ebola.com.ua>
 * @copyright Copyright 2013 Ebola Communications
 * @link      http://www.ebola.com.ua/
 */

Yii::import('zii.widgets.grid.CDataColumn');

class BDataColumn extends CDataColumn
{
    /**
     * @see CDataColumn::getFilterCellContent()
     */
    public function getFilterCellContent()
    {
        if (is_string($this->filter))
            return $this->filter;
        elseif ($this->filter !== false && $this->grid->filter !== null
                && $this->name !== null && strpos($this->name,'.') === false) {
            if (is_array($this->filter))
                return CHtml::activeDropDownList($this->grid->filter,
                                                $this->name, $this->filter,
                                                array(
                                                    'id'     => false,
                                                    'prompt' => '',
                                                    'class'  => 'form-control'
                                                ));
            elseif ($this->filter === null)
                return CHtml::activeTextField($this->grid->filter, $this->name,
                            array('id' => false, 'class' => 'form-control'));
        } else
            return parent::getFilterCellContent();
    }
}
